<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>锐信内容管理系统-数据管理</title>
<%@include file="/WEB-INF/pages/common/taglibs.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}resources/css/jquery.fancybox.css" /> 
<link rel="stylesheet" type="text/css" href="${ctx}resources/css/list.css" /> 
<script type="text/javascript" src="${ctx}resources/js/table.js"></script>
<script type="text/javascript" src="${ctx}resources/js/page.js"></script>
<script type="text/javascript" src="${ctx}resources/js/jquery.fancybox-1.2.1.pack.js"></script>
<script type="text/javascript" src="${ctx}resources/js/jquery.messager.js"></script>
</head>
<style>
.content button[type="submit"]
{
   float: right;
   width: 30px;
}
.content textarea {
    width:80%;
    max-width: 90%;
    height:200px;
}


</style>
	<script type="text/javascript">
		$(document).ready(function() {
			$("a").fancybox(); 
		});
		function operate(t){
			var pageNo = $("#pageNo").val();
			var id = $("#pid").val();
			var check = $("input[name='objId']:checked");
			var value= "";
			check.each(function(i){        //循环拼装被选中项的值
				value +=$(this).val()+"-";
			 });
			if(value==""&&t!="paste"){
				alert("至少选择一个要操作的项目！");
				return ;
			}
			$.ajax({
				  type: 'POST',
				  url:"${ctx}digital/operate.htm",
				　 data:{ids:value,pid:id,type:t},
				  success: function(data){
					  $.messager.show(0,data, 2000);
					 if(t=='paste'){
						 setTimeout(function(){
							  window.location.href="${ctx}digital/list.htm?pid=${pid}&pageNo=${page.pageNo}&jsessionid=${sessionId}";
						  },2500);
					 }
				  }
				});
		}
		
		function deleteDigital(id,pid){
			if(!confirm('删除将无法恢复,确定要删除吗？')){
				return ;
			}
			if(pid==0&&!confirm('确定要删除根节点吗？')){
				return;
			}
			var pageNo = $("#pageNo").val();
			$.ajax({
				  type: 'POST',
				  url:"${ctx}digital/delete.htm",
				　 data:{pageNo:pageNo,ids:id},
				  success: function(data){
					  alert(data);
					  window.location.href="${ctx}digital/list.htm?pid=${pid}&pageNo=${page.pageNo}&jsessionid=${sessionId}";
				  }
				});
		}
		
		function toList(id){
			window.location.href="${ctx}digital/list.htm?&pageNo=${page.pageNo}&pid="+id
		}
		function editDigital(id){
			window.location.href="${ctx}digital/edit.htm?pageNo=${page.pageNo}&id="+id
		}
		function add(){
			var pid = $("#pid").val();
			window.location.href="${ctx}digital/edit.htm?pid="+pid+"&pageNo=${page.pageNo}&jsessionid=${sessionId}";
		}
		
	</script>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<form id="mainForm" action="${ctx}digital/list.htm" method="POST">
	<input type="hidden" name="pageNo" id="pageNo" value="${page.pageNo}" />
	<input type="hidden" name="pid" id="pid" value="${pid}" />
	  <tr>
	    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
	          <tr>
	            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
	              <tr>
	                <td width="6%" height="19" valign="bottom"><div align="center"><img src="${ctx}resources/images/tb.gif" width="14" height="14" /></div></td>
	                <td width="94%" valign="bottom"><span class="STYLE1"> 数据基本信息列表</span></td>
	              </tr>
	            </table></td>
	            <td><div align="right"><span class="STYLE1">
	              <input type="checkbox" name="checkbox11" id="selectAll" />
	              全选      &nbsp;&nbsp;<span  onclick="add()"  style="cursor: pointer;"><img src="${ctx}resources/images/add.gif" width="10" height="10" /> 添加   &nbsp;&nbsp;</span>
	              <span onclick="operate('copy')" style="cursor: pointer;"><img src="${ctx}resources/images/add.gif" width="10" height="10" />复制</span> &nbsp;&nbsp;
	               <span onclick="operate('cut')" style="cursor: pointer;"> <img src="${ctx}resources/images/edit.gif" width="10" height="10"  /> 剪切  </span>  &nbsp;&nbsp;
	               <span  onclick="operate('paste')" style="cursor: pointer;"> <img src="${ctx}resources/images/edit.gif" width="10" height="10" /> 粘贴</span>    &nbsp;&nbsp;
	                <span url="digital" id="delete"  style="cursor: pointer;"><img src="${ctx}resources/images/del.gif" width="10" height="10"  /> 删除   &nbsp;</span></span>
	              <span class="STYLE1"> &nbsp;</span></div></td>
	          </tr>
	        </table></td>
	      </tr>
	    </table></td>
	  </tr>
	  <tr>
	    <td><table width="100%" border="0" cellpadding="0" class="tbl_list"  cellspacing="1">
	    <tr style="padding-top: 2px">
				<th class="STYLE19"  colspan="15" align="left">
					<span style="padding-left: 40px;">标题:<input width="50px" type="text" name="filter_LIKES_title" value="${param['filter_LIKES_title']}"> </span>
					<span style="padding-left: 20px">${param['filter_EQB_status']}状态: <select name="filter_EQB_status">
						<option value="1" ${param['filter_EQB_status']?"selected":""}>上线</option> 
						<option value="0" ${param['filter_EQB_status']?"selected":""}>下线</option> 
						</select> </span>
					<span style="padding-left: 20px"><input type="button"
							name="" onclick="search();" value="查询"> </span>
				</th>
			</tr>
	      <tr>
	        <th  width="5%"  bgcolor="d3eaef" class="STYLE10"><div align="left">
	          <input type="checkbox" name="checkbox" id="checkall" title="全选"/>
	        </div></th>
	        <th width="10%"  bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">标题</span></div></th>
	        <th  width="5%"   bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">类型</span></div></th>
	        <th  width="5%"  bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">状态</span></div></th>
	        <th  width="30%"   bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">正文</span></div></th>
	        <th  width="30%"   bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">描述</span></div></th>
	        <th  width="5%"  bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">积分</span></div></th>
	        <th  width="10%"  bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">操作</span></div></th>
	      </tr>
	      <c:forEach items="${page.result}" var="digital">
		      <tr>
		        <td align="left">
		          <input type="checkbox" name="objId" value="${digital.id}" title="${digital.id}"/>
		          <c:if test="${not empty digital.logo  }"><a href="${ctx}${digital.logo}"><img src="${ctx}resources/images/image.png" style="margin: 0px; padding: 0px; border: 0px;"></a></c:if>
		        </td>
		        <td ><div align="center"><span onclick="toList(${digital.id})" style="cursor: pointer;text-decoration: underline;">${digital.title}</span></div></td>
		        <td><div align="center">${digital.digitalType eq "0"?"栏目":"数据"}</div></td>
		        <td><div align="center"> ${digital.status?"上线":"下线"}
		        </div></td>
		        <td  ><span style="width:100%;height: 95%;float: left;" class="content">${digital.textContent}</span></td>
		        <td  ><span style="width:100%;height: 95%;float: left;" class="content">${digital.description}</span></td>
		        <td  ><div align="center">${digital.integral}</div></td>
		        <td  ><div align="center"><span onclick="deleteDigital(${digital.id},${digital.pid})" style="cursor: pointer;">删除</span>|<span onclick="editDigital(${digital.id})" style="cursor: pointer;">编辑</span></div></td>
		      </tr>
	      </c:forEach>
	    </table></td>
	  </tr>
	  <tr>
	    <td height="30"><%@include file="/WEB-INF/pages/common/footer.jsp"%></td>
	  </tr>
  </form>
</table>
</body>
</html>
